import React, {Component} from 'react';

class Detail extends Component {
  constructor(props) {
    super(props)

    this.state = {};
  }

  render() {
    let file = this.state.file;
    let domain = this.state.domain;
    let filedom = null;
    if(file){
      switch (file.mimeType) {
        case 'video/mp4':
          filedom = <video src={domain + file.key} controls="controls"></video>
          break;
        case 'image/jpeg':
        case 'image/png':
          filedom = <img src={domain + file.key}></img>
          break;
      }
    }
    return (
      <div className="App">
        <header className="App-header">
          detial

          {filedom}
        </header>


      </div>
    )
  }

  componentDidMount() {

    console.log(this.props.location.state);
    this.setState(this.props.location.state);
  }
}

export default Detail;
